
<template>
<view class="user-order">
	<view class="" >
		<view class="order-bg">
			<u-navbar  title="订单列表" :background="background" title-color="#fff" back-icon-color="#fff" ></u-navbar>
		</view>
	</view>
    <tabs :current="active" @change="changeShow" bar-width="30" :is-scroll="false">
        <tab v-for="(item, index) in order" :key="index" :name="item.name">
			<view class="">
				<transport-list ref="transportChilden" :order-type="item.type" ></transport-list>
			</view>
            <!-- <order-list  :order-type="item.type" :i="index" :index="active"></order-list> -->
        </tab>
    </tabs>
</view>
</template>

<script>

import { orderType } from '@/utils/type';
import {transportList} from '@/api/user'

export default {
  data() {
    return {
      active: 0,
	  list:[],
      order: [
		  {
		    name: '全部',
		    type: ''
		  },
		{
        name: '进行中',
        type:1
      }, {
        name: '已完成',
        type:2
      }, {
        name: '已取消',
        type: 3
      }],
	   background:{
		 background: 'url() no-repeat',
	   }
    };
  },
  onLoad (options) {
    
    this.changeShow(0);
	// this.transportListFun();
  },
  onShow() {
  
	
	this.$refs.transportChilden[this.active].refreFun()
  },
  methods: {
    changeShow(index) {
		// console.log('切换返回值',index)
	
		if(index != -1) {
			// console.log('onshow',this.$refs.transportChilden[index])
			// console.log('onshow',this.$refs.transportChilden[this.active])
			this.$refs.transportChilden[index].downCallback()
			this.$nextTick(() => {
				this.active = index
			})
		}
    },
	transportListFun(){
		transportList().then(res=>{
			console.log(res)
			this.list = res.data.lists
		})
	}
  }
};
</script>
<style scoped lang="scss">
	.order-bg{
		
	}
</style>